﻿<UserControl x:Class="SilverlightSnoop.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:tk="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
             xmlns:vti="clr-namespace:VisualTreeInspector"
             xmlns:stupidAsshole="clr-namespace:System.Windows;assembly=System.Windows.Controls"
             xmlns:tk2="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
             mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        
        <Grid Width="250">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <StackPanel>
                    <Button Content="Create Instance of selected type..."
                            x:Name="btnCreate"
                            CommandParameter="{Binding ElementName=treSnoopView, Path=SelectedItem}"/>
                </StackPanel>

                <tk:TreeView Grid.Row="1"
                             x:Name="treSnoopView">
                    <tk:TreeView.ItemTemplate>
                        <stupidAsshole:HierarchicalDataTemplate ItemsSource="{Binding Assemblies}">
                            <stupidAsshole:HierarchicalDataTemplate.ItemTemplate>
                                <stupidAsshole:HierarchicalDataTemplate ItemsSource="{Binding Types}">
                                    <stupidAsshole:HierarchicalDataTemplate.ItemTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Name}" />
                                        </DataTemplate>
                                    </stupidAsshole:HierarchicalDataTemplate.ItemTemplate>
                                    <TextBlock Text="{Binding Name}" />
                                </stupidAsshole:HierarchicalDataTemplate>
                            </stupidAsshole:HierarchicalDataTemplate.ItemTemplate>
                            

                            <TextBlock Text="{Binding Name}" />
                        </stupidAsshole:HierarchicalDataTemplate >
                    </tk:TreeView.ItemTemplate>
                </tk:TreeView>
            </Grid>
        </Grid>

        <tk:TabControl x:Name="tabCurrentXAPs"
                       Grid.Column="1">
            
        </tk:TabControl>
        
        
        <Grid Grid.Column="2">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <vti:Inspector x:Name="inspectorGadget"
                               VisualRoot="{Binding ElementName=tabCurrentXAPs, Path=SelectedItem.Content}" />
                <tk2:Expander ExpandDirection="Down"
                              Grid.Row="1"
                              Header="Properties">
                    <ListBox ItemsSource="{Binding ElementName=inspectorGadget, Path=SelectedItem.Properties}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition />
                                    </Grid.ColumnDefinitions>

                                    <TextBlock Text="{Binding Name}"
                                               Margin="4"
                                               VerticalAlignment="Center" />
                                    <TextBlock Text="{Binding Type}"
                                               Margin="4"
                                               Grid.Column="1"
                                               VerticalAlignment="Center" />
                                    <TextBlock Text="{Binding Value}"
                                               Margin="4"
                                               Grid.Column="2"
                                               VerticalAlignment="Center" />

                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </tk2:Expander>
                <tk:GridSplitter Grid.Row="1"
                                 HorizontalAlignment="Stretch"
                                 VerticalAlignment="Top"
                                 Height="3" />
            </Grid>
        </Grid>
        <tk:GridSplitter Grid.Column="1"
                         HorizontalAlignment="Left"
                         VerticalAlignment="Stretch"
                         Width="2" />
        <tk:GridSplitter Grid.Column="2"
                         HorizontalAlignment="Left"
                         VerticalAlignment="Stretch"
                         Width="2" />
    </Grid>
</UserControl>
